package com.zxy.supplier_system.server.utils

import com.zxy.supplier_system.server.entity.*
import java.time.LocalDate

data class NullableLocalDateRange(
    val start: LocalDate? = null,
    val end: LocalDate? = null,
)

data class OnlyIntId(
    val id: Int
)

data class IntIdAndName(
    val id: Int,
    val name: String
)

data class StringIdAndName(
    val id: String,
    val name: String
)

data class LongIdAndName(
    val id: Long,
    val name: String
)


fun ProcurementSupplier.toIntIdAndName(): IntIdAndName {
    return IntIdAndName(id, name)
}

fun DirectSaleClient.toIntIdAndName(): IntIdAndName {
    return IntIdAndName(id, name)
}

fun Market.toIntIdAndName(): IntIdAndName {
    return IntIdAndName(
        id, name
    )
}

fun Employee.toIntIdAndName(): IntIdAndName {
    return IntIdAndName(
        id!!, name
    )
}


fun Factory.toIntIdAndName(): IntIdAndName {
    return IntIdAndName(
        id, name
    )
}

fun GoodsCategory.toIntIdAndName(): IntIdAndName {
    return IntIdAndName(
        id, name
    )
}

fun GoodsBrand.toIntIdAndName(): IntIdAndName {
    return IntIdAndName(
        id, name
    )
}

fun GoodsBrandGroup.toIntIdAndName(): IntIdAndName {
    return IntIdAndName(
        id, name
    )
}

fun GoodsUnit.toLongIdAndName(): LongIdAndName {
    return LongIdAndName(
        id!!, name
    )
}


fun SystemService.toStringIdAndName(): StringIdAndName {
    return StringIdAndName(
        id, name
    )
}

fun Role.toIntIdAndName(): IntIdAndName {
    return IntIdAndName(
        id!!,name
    )
}